    <?php $this->load->view('wedding/wedding_head');?>
    <script type='text/javascript'>
    	function check_phone(){
			var phone = $('#phone').val();
			if(phone == ''){
				//为空
				$('#phone_error').attr('class','error');
				$('#phone_error').html('电话号码不能为空');
				}else {
				//进行正则的校验
					if (/^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/.test(phone)){
						//通过校验
						$('#phone_error').attr('class','moreInfo');
						$('#phone_error').html('');
						} else {
						//没有通过校验
							$('#phone_error').attr('class','error');
							$('#phone_error').html('电话号码格式不正确');
							}
				}
        	}
    	function check_address(){
			var address = $('#address').val();
			if(address.length < 6 || address.length > 30){
				$('#address_error').attr('class','error');
				$('#address_error').html('请输入有效的地址,6-30位');
				}else {
				$('#address_error').attr('class','moreInfo');
				$('#address_error').html('');
					}
        	}
    	var xxx='no';
    	var yyy='no';
    	var xy='no';
    	function check_map(){
			if(xxx == 'no' || yyy == 'no' || xy == 'no'){
				alert('请在地图中选择公司的坐标位置');
				}
        	}
    	function send_xy(){
			//此函数将把地图坐标和比例尺保存到隐藏表单域
			$('#x').val(xxx);
			$('#y').val(yyy);
			$('#xy').val(xy);
			
        	}
    	function check_all(){
    		check_phone();
    		check_address();
    		check_map();
    		//检查是否选择了标记点
    		var phone_error = $('#phone_error').html();
    		var address_error = $('#address_error').html();
    		if (phone_error.length > 3 || address_error.length > 3 || xxx == 'no' || yyy == 'no' || xy == 'no' ){return false;} else {send_xy();return true;}
        	}
    </script>
    <input type="hidden" id="page_code" value="2"/>
    <!-- begin: main content area #main -->
     <div id="main">
      <!-- begin: #col1 - first float column -->
      <div id="col1" role="complementary">
        <?php $this->load->view('wedding/wedding_left_nav.php')?>
      </div>
      <!-- end: #col1 -->
      <!-- begin: #col3 static column -->
      <div id="col3" role="main">
        <div id="col3_content" class="clearfix">
           
           <div class="my_box">
            <p class="box_title"><span>婚庆公司联系方式管理</span></p>
          	<form onsubmit='return check_all()' action="<?php echo base_url();?>index.php/wedding/weddingManagerAction/contact" method="post">
          		<input type="hidden" id="hidden_action" name="action"/>
	            <div style="color:red;margin:20px;"></div>  	
	          	<ul class="userInfo" style="margin-top:20px">
	          		
	          		<li>
	          			<span class="label">*公司电话:</span>
		         		<input type="text" onblur='check_phone()' id='phone' name="phone" size="50" value=""/> 
		         		<span id='phone_error' class="moreInfo">公司电话必须填写  可以写多个</span>		
	         		</li>
	          		
	          		<li>
	          			<span class="label">*所在区域:</span>
	          			<span id="area_text">未选择</span> <a href="#">【请选择】</a>
	          			<input type="hidden" id="area" name="area"/>
	          			<span class="moreInfo">必填项、为了网友方便查询</span>		
	         		</li>
	          		
	          		<li>
	          			<span class="label">*公司地址:</span>
	          			<input type="text" onblur='check_address()' id='address' name="address" size="255" value=""/> 
		         		<span id='address_error' class="moreInfo">公司地址必须填写</span>		
	         		</li>
	          		
	          		<li>
	          			<span class="label">*地图位置:</span>
	          			<p style="display: block;">
	          			 <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false" type="text/javascript"></script>
	          			 <button type="button" onclick="aa();">确定公司位置</button>
	          			 <!-- 用于暂存地图坐标的隐藏表单域 -->
	          			 <input type='hidden' name='x' id='x' value=''>
	          			 <input type='hidden' name='y' id='y' value=''>
	          			 <input type='hidden' name='xy' id='xy' value=''>
	          			 <input type='submit' value='提交'>
	          			 <div id="map_canvas" style="width: 600px; height: 400px;margin-left:30px;"></div>
	          			 <script>
	          			     var map = null;
	          				 if (GBrowserIsCompatible()) {
		          		        map = new GMap2(document.getElementById("map_canvas"));
			          		    map.addControl(new GSmallMapControl());
			          		    var center = new GLatLng(41.75, 123.45);
				          	    map.setCenter(center, 10);
		          		      }
		          		      function aa() {
			          		    	var marker = new GMarker(center, {draggable: true});
					          	    marker.openInfoWindowHtml("拖拽标记选择公司位置");
					          	    GEvent.addListener(marker, "dragstart", function() {
					          	          map.closeInfoWindow();
					          	    });
					          	   GEvent.addListener(marker, "dragend", function() {
					          	          marker.openInfoWindowHtml("公司所在地" + map.getCenter().lat() + "    " +  map.getCenter().lng() + "    " + map.getZoom());
					          	          xxx = map.getCenter().lat();
					          	          yyy = map.getCenter().lng();
					          	          xy = map.getZoom();
					          	   });
						           map.addOverlay(marker);
			          		  }
		          			          			 
	          			 </script>
	          			</p>
	          		</li>
	          	</ul>
	          
          	</form>
          </div>
        </div>
        <div id="ie_clearing">&nbsp;</div>
        <!-- End: IE Column Clearing -->
      </div>
      <!-- end: #col3 -->
    </div>
   
    <!-- end: #main -->
<?php $this->load->view('user/footer');?>